package com.twu.biblioteca.Models;

/**
 * User: haruo
 * Date: 5/29/13
 */
public class Movie {
    private String title;
    private Integer year;
    private String director;
    private Integer rating;

    public Movie(String title, Integer year, String director, Integer rating) {
        this.title = title;
        this.year = year;
        this.director = director;
        this.rating = rating;
    }

    @Override
    public String toString() {
        String movieDescription = this.title + "\t" + this.year + "\t" + this.director + "\t";
        if (this.rating != null && this.rating > 0 && this.rating < 10) {
            for (int i=0; i<this.rating;i++) {
                movieDescription += "*";
            }
        } else {
            movieDescription += "N/A";
        }
        movieDescription += "\n";
        return movieDescription;
    }
}
